Skip to content

Add zh, zh-Hans-CN, and zh-Hant-TW #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented May 20, 2025

This adds app_zh.arb so that locales like "zh-Hans-CN" can have their
code generated.

This is because flutter gen-l10n requires a base locale to be present.
Only having "zh-Hans-CN" and "zh-Hant-TW" and gives us the following error.

Arb file for a fallback, zh, does not exist, even though 
the following locale(s) exist: [zh_Hans_CN, zh_Hant_TW]. 
When locales specify a script code or country code, a 
base locale (without the script code or country code) should 
exist as the fallback. Please create a {fileName}_zh.arb 
file.

"zh" will not appear on Weblate, though, because we exclude it from
settings. This is intentional since it only makes sense to translate
the more specific locales like "zh-Hans-CN" and "zh-Hant-TW".

CZO discussion:
https://chat.zulip.org/#narrow/channel/58-translation/topic/zh_*.20in.20Weblate/near/2174667

The following are screenshots from my Android device, with different system language preferences set.

zh-Hans-CN zh-Hant-TW zh-Hant-HK
image image image

(zh-Hant-HK resolves to zh-Hant-TW)

@gnprice
Copy link
Member

gnprice commented May 21, 2025

Cool, thanks.

I just sent #1522 as a pure cherry-pick of the commit that went into v0.0.29. If we merge that first, then that will facilitate comparing v0.0.29 with upcoming versions in main; it should also simplify this change somewhat by taking care of most of the unrelated changes that had accumulated.

@PIG208 PIG208 changed the title Update translations from Weblate with app_zh.arb added, support zh-Hant-TW Add zh, zh-Hans-CN, and zh-Hant-TW May 22, 2025
@PIG208 PIG208 marked this pull request as ready for review May 22, 2025 16:30
@PIG208
Copy link
Member Author

PIG208 commented May 22, 2025

This is also an experiment of how Weblate processes new languages we added. I suppose ar (Arabic) was added to Weblate from our GitHub remote as opposed to the other way around. This time we will see if Weblate successfully ignores zh with a language filter we set up for this.

@PIG208 PIG208 requested a review from chrisbobbe May 22, 2025 16:34
@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label May 22, 2025
Normally, instead of doing it manually, we would add new languages
from Weblate's UI.  In this case, the ones added in this commit are
not offered there.  So we will commit this to GitHub first, and let
Weblate pull the changes from there.

The language identifier zh is left empty, and is set to be ignored
on Weblate for translations.  Translator will be expected translate
strings for zh-Hans-CN and zh-Hant-TW instead.  We can add more
locales with the zh language code if users request them.

See CZO discussion on how we picked these language identifiers:
  https://chat.zulip.org/#narrow/channel/58-translation/topic/zh_*.20in.20Weblate/near/2177452
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants